package com.module.aichat.ui.widget.inputview

import android.view.View
import com.module.aichat.data.bean.InputModel

/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：25/6/2025
 *
 * 描述：
 *
 * 修订历史：
 *
 */
class ChatEditorCompat private constructor(
    private val inputView: ChatInputView
) {
    fun switchModel(model: InputModel) {
        inputView.switchModel(model)
    }

    fun setEnabled(isEnabled: Boolean) {
        inputView.isEnabled = isEnabled
    }

    class Build constructor(
        private val inputView: ChatInputView,
        contentView: View
    ) {
        init {
            // 不强制要求LinearLayout，兼容ConstraintLayout
            inputView.setContentView(contentView)
        }

        private var chatInputListener: ChatInputListener? = null

        fun bindListener(chatInputListener: ChatInputListener): Build {
            this.chatInputListener = chatInputListener
            return this
        }

        fun builder(): ChatEditorCompat {
            val chatEditor = ChatEditorCompat(inputView)
            inputView.chatInputListener = chatInputListener
            return chatEditor
        }
    }
}